<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
      </head>
      <body>
        <script>
          let arr = [];
          let adult = "";
          let sum = 0;
          while (arr.length < 5) {
            let num = +prompt(`请输入第${arr.length + 1}年龄`);
            if (num <= 100 && num > 0) {
              arr.push(num);
            }
          }
          let max = arr[0];
          let lisit = arr[0];
          for (let i = 0; i < arr.length; i++) {
            if (arr[i] >= 18) {
              adult = arr[i];
            }
            if (arr[i] > max) {
              max = arr[i];
            }
            if (arr[i] > lisit) {
              lisit = arr[i];
            }
            document.write(`这是成年人筛选出的${adult}`);
            sum += arr[i];
          }

          document.write("<br>");
          document.write(`这是所有年龄的综合${sum}`);
          document.write("<br>");
          let average = sum / arr.length;
          document.write(`这是所有年龄的平均年龄${average}`);
          document.write("<br>");
          document.write(`这是所有年龄的最大年龄${max}`);
          document.write(`这是所有年龄的最小年龄${lisit}`);
        </script>
      </body>
    </html>
  </body>
</html>
